package com.zhenhao.xsq.ui.activity.login;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import com.zhenhao.xsq.R;
import com.zhenhao.xsq.application.AppConfig;
import com.zhenhao.xsq.base.BaseActivity;
import com.zhenhao.xsq.ui.activity.login.component.DaggerRegisterComponent;
import com.zhenhao.xsq.ui.activity.login.contract.RegisterContract;
import com.zhenhao.xsq.ui.activity.login.module.RegisterModule;
import com.zhenhao.xsq.ui.activity.login.presenter.RegisterPresenter;
import com.zhenhao.xsq.utils.DialogUtils;

import java.util.Arrays;

import javax.inject.Inject;

import androidx.core.content.ContextCompat;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class RegisterActivity extends BaseActivity implements RegisterContract.View {

    @Inject
    RegisterPresenter mPresenter;
    @BindView(R.id.et_last_name)
    EditText etLastName;
    @BindView(R.id.et_first_name)
    EditText etFirstName;
    @BindView(R.id.et_father_name)
    EditText etFatherName;
    @BindView(R.id.et_phone)
    EditText etPhone;
    @BindView(R.id.et_code)
    EditText etCode;
    @BindView(R.id.tv_city)
    TextView tvCity;
    @BindView(R.id.tv_street)
    TextView tvStreet;
    @BindView(R.id.tv_road)
    TextView tvRoad;
    @BindView(R.id.tv_community)
    TextView tvCommunity;
    @BindView(R.id.tv_build)
    TextView tvBuild;
    @BindView(R.id.et_pwd)
    EditText etPwd;
    @BindView(R.id.et_pwd_confirm)
    EditText etPwdConfirm;
    @BindView(R.id.bt_register)
    Button btRegister;
    @BindView(R.id.tv_get_code)
    TextView tvGetCode;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void initView() {
        setContentView(R.layout.activity_register);
        ButterKnife.bind(this);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
//        setToolbarTitle("欢迎注册");

//        rootLayout.setBackground(ContextCompat.getDrawable(this,R.mipmap.bg_activity_base));
        autolayout.setBackgroundColor(ContextCompat.getColor(this, R.color.color_e7edff));
        mToolbar.setBackgroundColor(ContextCompat.getColor(this, R.color.color_e7edff));
        toolbarTitle.setTextColor(ContextCompat.getColor(this, R.color.color_333333));
        toolbarMenu.setTextColor(ContextCompat.getColor(this, R.color.color_2d97ff));
        mToolbar.setNavigationIcon(ContextCompat.getDrawable(this, R.mipmap.toolbar_back2));
        rootLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.color_e7edff));
    }

    @Override
    protected void initData() {

    }


    @Override
    protected void setupActivityComponent() {
        DaggerRegisterComponent
                .builder()
                .appComponent(((AppConfig) getApplication()).getApplicationComponent())
                .registerModule(new RegisterModule(this))
                .build()
                .inject(this);
    }

    @Override
    public void showProgressDialog() {
        progressDialog.show();
    }

    @Override
    public void closeProgressDialog() {
        progressDialog.hide();
    }

    @Override
    public void setPresenter(RegisterContract.RegisterContractPresenter presenter) {
        mPresenter = (RegisterPresenter) presenter;
    }

    @OnClick({R.id.tv_city, R.id.tv_street, R.id.tv_road, R.id.tv_community, R.id.tv_build,
            R.id.bt_register,R.id.tv_get_code})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.tv_city:
                break;
            case R.id.tv_street:
                break;
            case R.id.tv_road:
                break;
            case R.id.tv_community:
                DialogUtils.showBottomDialog(this, "" + getResources().getString(R.string.请选择),
                        Arrays.asList("综合管理服务"
                                , "公共设施设备"
                                , "公共区域清洁卫生"
                                , "公共区域秩序维护"
                                , "公共区域绿化养护"
                                , "其它"), new DialogUtils.onTreeSelect() {
                            @Override
                            public void onTreeSelect(String str, int position) {

                            }
                        });
                break;
            case R.id.tv_build:
                break;
            case R.id.bt_register:
                break;
            case R.id.tv_get_code:
                break;
        }
    }
}
